#ifndef DYNAMICS_CONTROLLER_BASE_H
#define DYNAMICS_CONTROLLER_BASE_H

#include "Modeling/Robot.h"
#include "Sensor.h"
#include "Command.h"
#include <myfile.h>

class RobotController
{
public:
  RobotController(Robot& _robot)
    : robot(_robot),time(0),sensors(NULL),command(NULL)
  {}
  virtual ~RobotController() {}
  //subclasses fill these out
  virtual void Update(Real dt) { time+=dt; }
  virtual void Reset() { time=0; } 
  virtual bool ReadState(File& f) {
    if(!ReadFile(f,time)) return false;
    return true;
  }
  virtual bool WriteState(File& f) const {
    if(!WriteFile(f,time)) return false;
    return true;
  }

  Robot& robot;
  Real time;

  RobotSensors* sensors;  //sensory input (filled in by simulator)
  RobotCommand* command;  //joint command output (output to simulator)
};

#endif
